{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 环境初始化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "from _common import 环境初始化\n",
    "环境初始化()\n",
    "from IPython.display import SVG as 查看作品\n",
    "from 神笔码靓.神笔库.神笔绘图板 import 神笔绘图板\n",
    "from 神笔码靓.神笔库.定义集 import *\n",
    "from 神笔码靓.神笔库.配置 import *\n",
    "from 神笔码靓.神笔库.通用工具集 import *\n",
    "from 神笔码靓.神笔库.定义集 import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 新手入门"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### 1. 创建一个无限高清图片，图片宽200，高100，在图片的中央写上文字“新手入门”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "作品文件路径 = 作品输出目录(\"1.新手入门\")\n",
    "\n",
    "绘图板宽 = 200\n",
    "绘图板高 = 100\n",
    "\n",
    "神笔=神笔绘图板(作品文件路径=作品文件路径, 高=绘图板高, 宽=绘图板宽)\n",
    "神笔.显示图框()\n",
    "神笔.写字(文字=\"新手入门\", x=100, y=50)\n",
    "神笔.完成()\n",
    "\n",
    "查看作品(作品文件路径)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 2. 创建一个无限高清图片，图片宽500，高200，在图片的中央画水平线和垂直线"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "作品文件路径 = 作品输出目录(\"2.水平线和垂直线\")\n",
    "\n",
    "绘图板宽 = 500\n",
    "绘图板高 = 200\n",
    "\n",
    "神笔=神笔绘图板(作品文件路径=作品文件路径, 高=绘图板高, 宽=绘图板宽)\n",
    "神笔.显示图框()\n",
    "神笔.画垂直线(y1=20, y2=180, x1=250, 描边颜色=颜色.红色)\n",
    "神笔.画水平线(x1=20, x2=480, y1=100)\n",
    "神笔.完成()\n",
    "\n",
    "查看作品(作品文件路径)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 3. 创建一个无限高清图片，图片宽500，高200，在图片上画圆和矩形"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "作品文件路径 = 作品输出目录(\"3.圆和矩形\")\n",
    "\n",
    "绘图板宽 = 500\n",
    "绘图板高 = 200\n",
    "\n",
    "神笔=神笔绘图板(作品文件路径=作品文件路径, 高=绘图板高, 宽=绘图板宽)\n",
    "神笔.显示图框()\n",
    "神笔.画圆(x=70, y=100, 半径=50, 描边颜色=颜色.红色, 描边宽度=3)\n",
    "神笔.画椭圆(x=200, y=100, 半径=(100,50), 描边颜色=颜色.蓝色, 描边样式=\"3,3\")\n",
    "神笔.画矩形(x=330, y=50, 宽=150, 高=100, 填充颜色=颜色.绿色)\n",
    "神笔.完成()\n",
    "\n",
    "查看作品(作品文件路径)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 4. 做一个简易的作文纸，可以用A4纸打印出来（PDF文件）"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "作品文件路径 = 作品输出目录(\"4.简易作文纸\")\n",
    "\n",
    "绘图板宽, 绘图板高 = 纸张大小.A4_纵向(1)\n",
    "\n",
    "页边距 = 50\n",
    "\n",
    "作文纸=神笔绘图板(作品文件路径=作品文件路径, 高=绘图板高, 宽=绘图板宽)\n",
    "\n",
    "简易作文纸颜色 = \"#FF1919\" # 红色\n",
    "\n",
    "作文纸.显示图框()\n",
    "作文纸.写字(文字=\"简易作文纸\", x=图片宽/2, y=页边距,字体=系统字体.楷体, 字体大小=20, 填充颜色=简易作文纸颜色)\n",
    "作文纸.画水平线(x1=页边距, x2=图片宽-页边距, y1=2 * 页边距, y2=图片高-页边距, 数量=25, 描边颜色=简易作文纸颜色)\n",
    "\n",
    "作文纸.完成()\n",
    "作文纸.生成PDF()\n",
    "\n",
    "查看作品(作品文件路径)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 5. 显示中国国旗的高清SVG图片"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "作品文件路径 = 作品输出目录(\"5.我爱中国\")\n",
    "\n",
    "中国国旗无限高清图片 = 资源库目录(\"国旗\\CifCn.svg\") # 中国国旗的SVG图片\n",
    "\n",
    "if 文件不存在(中国国旗无限高清图片):\n",
    "    报错(f\"{中国国旗无限高清图片}不存在，请先解压“资源库\\国旗.rar”，再运行代码\")\n",
    "\n",
    "绘图板宽, 绘图板高 = 500, 200\n",
    "\n",
    "神笔=神笔绘图板(作品文件路径=作品文件路径, 高=绘图板高, 宽=绘图板宽)\n",
    "\n",
    "神笔.贴图( x=20, y=20, 图片文件=中国国旗无限高清图片)\n",
    "神笔.写字(x =350, y=100, 文字=\"我❤中国\", 填充颜色=颜色.红色, 字体大小=50, 字体=系统字体.华文行楷)\n",
    "\n",
    "神笔.完成()\n",
    "\n",
    "查看作品(作品文件路径)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}